using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.OleDb;
using DTO;

namespace DAO
{
   public  class LoaiSachDAO
    {

       public static DataTable LayTatCaTheLoaiSach_DAO()
       {
           string sql = " Select * From LoaiSach ";
           DataTable dt = new DataTable();
           dt = DataProvider.ExcuteQuery(sql);
           return dt;
       }



       public List<LoaiSachDTO> _laydsloaisach_DAO()
       {
           List<LoaiSachDTO> list = new List<LoaiSachDTO>();
           string sql = "select * from LoaiDocGia";
           DataTable dt = DataProvider.ExcuteQuery(sql);
           if (dt.Rows.Count > 0)
           {
               for (int i = 0; i < dt.Rows.Count; i++)
               {
                   DataRow dr = dt.Rows[i];

                   int maloaisach = int.Parse(dr["MaLoaiSach"].ToString());
                   string tenloaisach = dr["TenLoaiSach"].ToString();

                   LoaiSachDTO ls = new LoaiSachDTO();
                   ls.Maloaisach = maloaisach;
                   ls.Tenloaisach = tenloaisach;
                   list.Add(ls);
               }
           }
           return list;
       }
    }

}
